-
Notifications
You must be signed in to change notification settings - Fork 8.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Reporting] Update more Server Types for TaskManager #74915
[Reporting] Update more Server Types for TaskManager #74915
Conversation
Pinging @elastic/kibana-reporting-services (Team:Reporting Services) |
@elasticmachine merge upstream |
@@ -113,6 +113,10 @@ export function createGenerateCsv(logger: LevelLogger) { | |||
break; | |||
} | |||
|
|||
if (cancellationToken.isCancelled()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is an interesting one... wonder how we missed it for so long
const exportType = reporting.getExportTypesRegistry().getById(exportTypeId); | ||
|
||
if (exportType == null) { | ||
throw new Error(`Export type ${exportTypeId} does not exist in the registry!`); | ||
} | ||
|
||
// encrypt the headers in the payload |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Small nit: you can combine both 46 and 48 into a parallel await
const [
scheduleTask,
{ store },
] = await Promise.all([
exportType.scheduleTaskFnFactory(reporting, logger) as ScheduleTaskFnType,
reporting.getPluginStartDeps()
]);
@@ -45,7 +45,7 @@ export const mapping = { | |||
priority: { type: 'byte' }, | |||
timeout: { type: 'long' }, | |||
process_expiration: { type: 'date' }, | |||
created_by: { type: 'keyword' }, | |||
created_by: { type: 'keyword' }, // `null` if security is disabled |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good callout
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I think it used to be false
but it sneakily changed through TS improvements. That shouldn't be a problem for mappings, I think.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some small nits/perf improvements
@joelgriffith I pushed up a commit per your feedback. I also removed some more type-casting in the routes, because I couldn't resist thanks to the help from #74879 |
💚 Build SucceededBuild metrics
History
To update your PR or re-run it, just comment with: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the context and cleanup of types! LGTM
jobParamsRison = jobParamsPayload; | ||
} else { | ||
const { jobParams: queryJobParams } = req.query as { jobParams: string }; | ||
const { jobParams: jobParamsPayload } = req.body; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yissssss that cleanup
* [Reporting] Update more Server Types for TaskManager * remove some task manager references * more strict * more strict 2 * simplify * fix test * fix test * routing validation unused types cleanup * remove more casting in route handlers * feedback changes * original comment was fine Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com> # Conflicts: # x-pack/plugins/reporting/server/export_types/printable_pdf/create_job/index.ts # x-pack/plugins/reporting/server/export_types/printable_pdf/types.d.ts # x-pack/plugins/reporting/server/lib/store/store.ts
* master: (23 commits) Adding API test for custom link transaction example (elastic#74238) [Uptime] Singular alert (elastic#74659) Revert "attempt excluding a codeowners directory" (elastic#75023) [Metrics UI] Remove TSVB dependency from Metrics Explorer APIs (elastic#74804) Remove degraded state from ES status service (elastic#75007) [Reporting/Functional] unskip pagination test (elastic#74973) [Resolver] Stale query string values are removed when resolver's component instance ID changes. (elastic#74979) Add public url to Workplace Search plugin (elastic#74991) [Reporting] Update more Server Types for TaskManager (elastic#74915) [I18n] verify select icu-message options are in english (elastic#74963) Make data.search.aggs available on the server. (elastic#74472) [Security Solution][Resolver] Graph Control Tests and Update Simulator Selectors (elastic#74680) attempt excluding a codeowners directory [ML] DF Analytics: allow failed job to be stopped by force via the UI (elastic#74710) Add kibana-core-ui-designers team (elastic#74970) [Metrics UI] Fix inventory footer misalignment (elastic#74707) Remove legacy optimizer (elastic#73154) Update design-specific GH code-owners (elastic#74877) skip test Reporting paginates content elastic#74922 [Metrics UI] Add Jest tests for alert previews (elastic#74890) ...
…75003) * [Reporting] Update more Server Types for TaskManager (#74915) * [Reporting] Update more Server Types for TaskManager * remove some task manager references * more strict * more strict 2 * simplify * fix test * fix test * routing validation unused types cleanup * remove more casting in route handlers * feedback changes * original comment was fine Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com> # Conflicts: # x-pack/plugins/reporting/server/export_types/printable_pdf/create_job/index.ts # x-pack/plugins/reporting/server/export_types/printable_pdf/types.d.ts # x-pack/plugins/reporting/server/lib/store/store.ts * fix test * fix test
Summary
Pulling changes out of #64853
Extends #65213
While working on removing ESQueue and using Task Manager, I found opportunistic ways to make the server types more strict, and allow some of the main modules such as ReportingStore to handle more corner cases. This PR takes out the opportunistic work out as a standalone PR.
List of changes:
ReportingCore.enqueueJob
method since the route handler can just importenqueueJobFactory
ESQueueCreateJobFn
toCreateJobFn
ESQueueWorkerExecuteFn
toWorkerExecuteFn
CreateJobBaseParams
andCreateJobBaseParamsEncryptedFields
to add stricter typing on job payloads (way lessunknown
in the system)ReportingStore.updateReport
and addsetReportClaimed
,setReportCompleted
,setReportFailed
Report
classconstants/statuses
file for use outside of ESQueueChecklist
Delete any items that are not applicable to this PR.
For maintainers